package com.wwt.blog.controller;

import com.wwt.blog.service.CommentService;
import com.wwt.blog.vo.Result;
import com.wwt.blog.vo.param.CommentParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/comments")
public class CommentController {
    @Autowired
    CommentService commentService;
    @GetMapping("/article/{id}")
    public Result getCommentsByArticleId(@PathVariable("id") Long id){
        return commentService.getCommentsByArticleId(id);
    }
    @PostMapping("create/change")
    public Result comment(@RequestBody CommentParam commentParam){
        return commentService.comment(commentParam);
    }

}
